import web

urls = (
    '/index', 'Index',  # 精确匹配
    '/blog/\d+', 'Blog',  # 模糊匹配，不带组
    '/(.*)', 'Hello',  # 模糊匹配，带组
)
app = web.application(urls, globals())


class Index:
    def GET(self):
        query = web.input()
        return f'Index {query}'


class Blog:
    def GET(self):
        query = web.input()
        # return f'Blog {query}'
        return web.ctx.env

    def POST(self):
        data = web.input()
        return f'Blog post {data}'


class Hello:
    def GET(self, name):
        # if not name:
        #     name = 'World'
        # return f'Hello, {name}!'
        return open(r'1.html').read()


if __name__ == '__main__':
    app.run()
